home *** CD-ROM | disk | FTP | other *** search
- /*
- File: AppLib.h
-
- Contains: Prototypes for the “guts” of a Macintosh application.
-
- Written by: Dave Falkenburg
-
- Copyright: © 1993 by Dave Falkenburg, all rights reserved.
-
- Change History (most recent first):
-
- */
-
- #ifndef _APPLIB_
- #define _APPLIB_
-
- #include "AppConditionals.h"
- #include "Preferences.h"
-
- #include <Types.h>
- #include <Windows.h>
- #include <Dialogs.h>
- #include <Menus.h>
- #include <Files.h>
- #include <AppleEvents.h>
- #include <StandardFile.h>
- #include <OCEStandardMail.h>
-
- #include "Window.h"
-
- #if qUseQuickDrawGX
- #include <FixMath.h> // make sure we don’t use GX lame #define of “fixed1”
- #include <graphics types.h>
- #endif
-
- // useful macros
-
- #if qDebug
- #define DebugMessage(x) DebugStr(x)
- #else
- #define DebugMessage(x)
- #endif
-
- // Resource IDs
-
- #define kErrorAlertID 128
- #define kStandardCloseAlertID 129
- #define kStandardCloseWithNewPubsAlertID 130
-
- #define kCoreErrorStrings 128
- #define kUnsupportedSystemSoftware 1
- #define kNeedsThreadManager 2
-
- #define kStandardCloseStrings 129
- #define kQuittingStr 1
- #define kClosingStr 2
-
- #define kPreferencesFileStrings 130
- #define kPreferencesFileName 1
-
- #define kSplashPictureID 128
-
-
- #if qUseQuickDrawGX
-
- // When using GX, we want to create a 300K graphics heap
- // NOTE: I have no idea what to use as a number here!
-
- #define kGraphicsHeapSize (300 * 1024)
-
- #endif
-
-
- // Useful functions provided by App:
-
- void HandleEvent(EventRecord *anEvent);
- void HandleClose(WindowPtr aWindow);
-
- short StandardAlert( short alertID,
- short defaultItem = ok,
- short cancelItem = 0,
- ModalFilterUPP customFilterProc = nil);
-
- void ErrorAlert(short stringList,short whichString);
- void FatalErrorAlert(short stringList,short whichString);
-
- extern ModalFilterUPP StandardDialogFilter;
- extern ModalFilterYDUPP StandardDialogFilterYD;
- extern void PseudoClickInDialogItem(DialogPtr theDialog, short itemToClick);
-
- enum StandardCloseResult
- {
- kSaveDocument = 1,
- kCancelSaveDocument = 2,
- kDontSaveDocument = 3
- };
-
- StandardCloseResult StandardCloseDocument(const StringPtr documentType,StringPtr documentName, Boolean hasNewEditions, Boolean quitting);
-
- OSErr CheckAppleEventForMissingParams(AppleEvent *theAppleEvent);
-
- short OpenPreferencesResFile(void);
-
- // AOCE “FrontWindow”-equivalent routine for the Standard Mail package
- extern FrontWindowUPP FrontWindowProcForAOCEUPP;
-
- // Globals
-
- extern Boolean gDone;
- extern Boolean gMenuBarNeedsUpdate;
-
- extern Boolean gHasColorQuickdraw;
- extern Boolean gHasThreadManager;
- extern Boolean gHasDragManager;
- extern Boolean gHasAOCE;
- extern Boolean gHasDisplayManager;
-
- #if qInlineInputAware
- extern Boolean gHasTextServices;
- extern Boolean gHasTSMTE;
- #endif
-
- #if qUseQuickDrawGX
- extern Boolean gHasQuickDrawGX;
- extern long gQuickDrawGXVersion;
- extern long gQuickDrawGXPrintingVersion;
- extern gxGraphicsClient gQuickDrawGXClient;
- #endif
-
- extern GrafPtr gWindowManagerPort;
- extern Rect gDeskRectangle;
- extern RgnHandle gMouseRegion;
-
- extern short gPreferencesRsrcRefNum;
-
- // Routines that the application MUST supply:
-
- extern OSErr SetupApplication(void);
- extern void TearDownApplication(void);
- extern void HandleMenu(TWindow * topWindowObj,long menuCode);
- extern void ConvertClipboard(void);
-
- extern OSErr OpenNewDocument(void);
- extern OSErr OpenDocument(LetterDescriptor *,void *);
- extern OSErr PrintDocument(LetterDescriptor *,void *);
- extern Boolean QuitApplication(void);
-
- #endif
-